home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1985 Winter
/
rerun-1985-winter.d64
/
make music
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
7KB
|
180 lines
1 poke52,56:poke56,56:clr:print"[147]please[157][157][157]waita[157][157][157][157][157]moment[157][157]for"
2 fori=1504to1543:pokei,3:next:print"create tunes 64"
3 print" by:[157][157][157]arthur t. chakalis[157][157][157][157][157][157]copyright ,1984";
4 dim h(36),l(36),d(36),hn(22),ln(22),hs(22),ls(22),nd(16)
5 def fnr(sl)=int((sl-984)/40):def fnc(sl)=sl-(fnr(sl)*40)-983:gosub47
6 poke49152,65:poke49153,71:poke49155,227:poke49156,5:poke1507,71
7 rem main loop, to ml subr.& return if firebutton pressed
8 sys49168:oc=peek(49152):nc=peek(49153)
9 sl=(256*peek(49156))+peek(49155):r=fnr(sl):c=fnc(sl)
10 ifr>23then20:rem routines at bottom of screen
11 ifc<4then8:rem out of range, notes can't be placed in 1st. 3 columns
12 ifoc<66then16:rem goto place note on staff
13 rem remove note from staff
14 poke49152,peek((r*40)+985):pokesl,peek(49152):h(c-3)=0:l(c-3)=0:gosub42
15 d(c-3)=0:pokesl,nc:goto8
16 ifd(c-3)<>0then8:rem place note ifa note isn't already in the column
17 pokesl+54272,13:d(c-3)=nd(nc-66):poke49152,nc:ifnc>74then19
18 h(c-3)=hn(r-1):l(c-3)=ln(r-1):pokesl+54272,11:goto8
19 h(c-3)=hs(r-1):l(c-3)=ls(r-1):pokesl+54272,11:goto8
20 ifoc>66thenpoke49153,oc:pokesl,oc:goto8:rem change note
21 ifoc<>9then32:rem change instrument
22 i=1+peek(1952)-48:ifi>8theni=1
23 ifi=1then w=65:ad=9:sr=0:hp=0:lp=255:goto31
24 ifi=2then w=17:ad=96:sr=60:hp=0:lp=0:goto31
25 ifi=3then w=33:ad=9:sr=0:hp=0:lp=0:goto31
26 ifi=4then w=17:ad=9:sr=0:hp=0:lp=0:goto31
27 ifi=5then w=17:ad=0:sr=240:hp=0:lp=0:goto31
28 ifi=6then w=33:ad=0:sr=240:hp=0:lp=0:goto31
29 ifi=7then w=17:ad=102:sr=0:hp=0:lp=0:goto31
30 ifi=8then w=33:ad=120:sr=0:hp=0:lp=0:goto31
31 poke1952,i+48:goto8
32 if oc<>20then35:rem change tempo
33 t=1+peek(1956)-48:ift>9thent=1
34 poke1956,t+48:goto8
35 ifoc<>16then 153:rem play notes
36 x=0:fori=1to36:ifd(i)=0then38
37 x=x+1:nexti
38 poke54274,lp:poke54275,hp:poke54277,ad:poke54278,sr:poke54296,v
39 fori=1tox:poke54276,w:poke54273,h(i):poke54272,l(i)
40 forj=0tod(i)/(1.4*t):nextj:poke54276,w-1:nexti
41 fori=54272to54300:pokei,0:nexti:goto8
42 s=54272: fori=stos+28:pokei,0:next
43 poke54296, 15 :poke54277,100 :poke54278,20
44 poke54276, 33 :poke54273, 56 :poke54272, 99
45 fori=1to 25 :next
46 fori=stos+28:pokei,0:next:return
47 printchr$(142):rem move character mem. loc.
48 poke56334,peek(56334)and254
49 poke1,peek(1)and251
50 fori=0to511:pokei+14336,peek(i+53248):next
51 poke1,peek(1)or4
52 poke56334,peek(56334)or1
53 poke53272,(peek(53272)and240)or14
54 rem print instructions
55 print"[147]create tunes displays a musical staff."
56 print"a joystick in port2 moves a notearound. "
57 print"the fire button places/erases a note on the staff."
58 print"the firebutton also does other functionswhen on the bottom line."
59 print"pressing it while over the following does:"
60 print" notes=picks up any note shown p=play notes entered"
61 print" i=change instrument "
62 print" t=change tempo"
63 print" e=create basic code for tune & deletes all else"
64 rem enter new character definitions
65 print"please wait a moment[145]":fori=512to599:readch:pokei+14336,ch:next
66 data 0,0,0,0,255,0,0,0,0,0,0,0,51,0,0,0,255,255,255,255,255,255,255,255
67 data 0,0,0,0,240,144,144,240,16,16,16,16,240,144,144,244,16,16,16,16,240
68 data 144,144,240,16,16,16,16,240,240,240,244,16,16,16,16,240,240,240,240
69 data 28,16,16,16,240,240,240,244,28,16,16,16,240,240,240,240
70 data 28,16,28,16,240,240,240,240
71 fori=536to599:pokei+14400,peek(i+14336):next
72 fori=600to663step8
73 pokei+14339,((peek(i+14339))+2)
74 pokei+14340,(peek(i+14340)+7)
75 pokei+14341,(peek(i+14341)+2):next
76 rem enter note data
77 fori=1to22:read hn(i),ln(i):next
78 fori=1to22:readhs(i),ls(i):next
79 fori=1to16:read nd(i):next
80 data25,30,22,96,21,31,18,209,16,195,15,210,14,24,12,143,11,48,10,143
81 data9,104,8,97,7,233,7,12,6,71,5,152,5,71,4,180,4,48
82 data3,244,3,134,3,35
83 data26,156,23,181,0,0,19,239,17,195,0,0,14,239,13,78,11,218,0,0
84 data9,247,8,225,0,0,7,119,6,167,5,237,0,0,4,251,4,112
85 data0,0,3,187,3,83
86 data1280,960,640,480,320,240,160,80,1280,960,640,480,320,240,160,80
87 rem poke ml subr. into mem.
88 for ad= 49168to 49351:read da:pokead,da:nextad
89 data 216, 173, 0, 220, 201, 111
90 data 240, 24, 201, 126, 240, 21
91 data 201, 125, 240, 40, 201, 123
92 data 240, 54, 201, 119, 240, 68
93 data 162, 160, 142, 5, 192, 76
94 data 17, 192, 96, 56, 173, 3
95 data 192, 233, 40, 133, 251, 173
96 data 4, 192, 233, 0, 133, 252
97 data 76, 123, 192, 133, 252, 76
98 data 123, 192, 24, 173, 3, 192
99 data 105, 40, 133, 251, 173, 4
100 data 192, 105, 0, 133, 252, 76
101 data 123, 192, 56, 173, 3, 192
102 data 233, 1, 133, 251, 173, 4
103 data 192, 233, 0, 133, 252, 76
104 data 123, 192, 24, 173, 3, 192
105 data 105, 1, 133, 251, 173, 4
106 data 192, 105, 0, 133, 252, 160
107 data 0, 177, 251, 201, 66, 208
108 data 3, 76, 17, 192, 141, 2
109 data 192, 173, 3, 192, 133, 253
110 data 173, 4, 192, 133, 254, 173
111 data 0, 192, 145, 253, 173, 2
112 data 192, 141, 0, 192, 173, 1
113 data 192, 145, 251, 165, 251, 141
114 data 3, 192, 165, 252, 141, 4
115 data 192, 173, 5, 192, 201, 32
116 data 240, 4, 56, 233, 32, 24
117 data 141, 5, 192, 170, 160, 0
118 data 136, 208, 253, 202, 208, 248
119 data 24, 76, 17, 192
120 print"press space bar to continue":gosub42
121 geta$:ifa$<>" "then121
122 rem screen setup
123 poke53280,15:poke53281,11:print"[147]":poke53281,15:poke646,11
124 print"[194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194][194]";
125 print"[194] g [194]";
126 print"[194][192]f[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][194]";
127 print"[194] e [194]";
128 print"[194][192]d[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][194]";
129 print"[194] c [194]";
130 print"[194][192]b[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][194]";
131 print"[194] a [194]";
132 print"[194][192]g[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][194]";
133 print"[194] f [194]";
134 print"[194][192]e[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][194]";
135 print"[194] d [194]";
136 print"[194][193]c[193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][193][194]";
137 print"[194] b [194]";
138 print"[194][192]a[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][194]";
139 print"[194] g [194]";
140 print"[194][192]f[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][194]";
141 print"[194] e [194]";
142 print"[194][192]d[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][194]";
143 print"[194] c [19